<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddFieldToOrderTable20240713 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('order', function (Blueprint $table) {
            if (!Schema::hasColumn('order', 'is_send_delivery')) {
                $table->tinyInteger('is_send_delivery')->default(0)->comment('是否发货：0未发货，1-待发货，2-已发货');
            }
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('order', function (Blueprint $table) {
            if (Schema::hasColumn('order', 'is_send_delivery')) {
                $table->dropColumn(['is_send_delivery']);
            }
        });
    }
}
